package com.hotel.comm.lucene.condition;

import com.hotel.comm.bean.EnumConstants.Reverse;
import com.hotel.comm.bean.EnumConstants.SortType;
import org.apache.lucene.search.SortField;

/**
 * lucene排序类
 *
 * @author XuSemon
 * @date 2015-4-26
 */
public class SearchSort {
    /**
     * 排序名称
     */
    private String sortName;
    /**
     * 排序类型
     */
    private SortField.Type type;
    /**
     * 排序顺序
     */
    private Reverse reverse;

    /**
     * 构造函数，根据排序名称、配需类及排序顺序构造类
     *
     * @param sortName
     * @param clazz
     * @param reverse
     */
    @SuppressWarnings("rawtypes")
    public SearchSort(String sortName, Class clazz, Reverse reverse) {
        this(sortName, SortType.getType(clazz), reverse);
    }

    public SearchSort(String sortName, SortField.Type type, Reverse reverse) {
        this.sortName = sortName;
        this.type = type;
        this.reverse = reverse;
    }

    public String getSortName() {
        return sortName;
    }

    public void setSortName(String sortName) {
        this.sortName = sortName;
    }

    public SortField.Type getType() {
        return type;
    }

    public void setType(SortField.Type type) {
        this.type = type;
    }

    public Reverse getReverse() {
        return reverse;
    }

    public void setReverse(Reverse reverse) {
        this.reverse = reverse;
    }
}
